<?php

namespace App\Model;

use App\Model\Traits\Common;
use App\Observers\CommentObserver;
use App\User;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;

class Comment extends Model
{
    use Common;
    use LogsActivity;
    protected static $logFillable=true;
    protected static $recordEvents=['created','updated'];
    protected static $logName='comment';
//   protected $fillable=[
//   ];
//    protected $guarded = [''];
    protected $fillable=['content','user_id'];
    public static function boot()
    {
        self::observe(CommentObserver::class);
        parent::boot(); // TODO: Change the autogenerated stub
    }

//获得发布评论的用户信息

    public function getModel(){
      return  $this->morphTo('comment');
    }
//    public function getMarkdownAttribute($key){
//        $parsedown= new \Parsedown();
//        return $parsedown->text($this['content']);
//    }

}
